#include "IWorld.h"

IWorld::IWorld(PhysicWorld* phyWorld)
{	
	physicWorld = phyWorld;	
}

IWorld::~IWorld(void)
{
}

void IWorld::Initialization(void)
{
	physicWorld->Initialization();
}

void IWorld::Update(DWORD elapsedTime)
{
	physicWorld->PreUpdate(elapsedTime);
	camera->UpdateCamera(elapsedTime);
	for(list<IObject*>::iterator it  = Objects.begin() ; it != Objects.end() ; it++)
	{
		it._Ptr->_Myval->Update(elapsedTime,camera);
	}

	for(list<ParticleSystem*>::iterator it  = particlesSystems.begin() ; it != particlesSystems.end() ; it++)
	{
		it._Ptr->_Myval->update(elapsedTime,camera);
	}
	

}

void IWorld::Draw(DWORD elapsedTime)
{
	for(list<IObject*>::iterator it  = Objects.begin() ; it != Objects.end() ; it++)
	{			
		it._Ptr->_Myval->Draw(elapsedTime,camera);
	}
	physicWorld->PosUpdate(elapsedTime);

	for(list<ParticleSystem*>::iterator it  = particlesSystems.begin() ; it != particlesSystems.end() ; it++)
	{
		it._Ptr->_Myval->draw();
	}
}
